<?php

define('DS', DIRECTORY_SEPARATOR);
define('PS', PATH_SEPARATOR);
define('CMS_ROOT_DIR', dirname(__FILE__));
define('CMS_APP_DIR',  CMS_ROOT_DIR . DS . 'application');
define('CMS_LIB_DIR',  CMS_ROOT_DIR . DS . 'libraries');
define('CMS_TEMP_DIR', CMS_ROOT_DIR . DS . 'temp');

set_include_path(PS . CMS_LIB_DIR . PS . get_include_path());

/**
 * Run the application
 * Use Zend_Application
 * @since 2.0.3
 */
require_once 'Zend/Application.php';
$application = new Zend_Application(
    'production',
    CMS_APP_DIR . DS . 'config'. DS . 'application.ini'
);

/**
 * Don't store following options to application.ini, because when user try to install,
 * the installer can not save these options to application.ini
 * (it replaces TOMATO_APP_DIR with real path)
 */
$options = array(
	'bootstrap' => array(
    	'path' 	=> CMS_APP_DIR . DS . 'Bootstrap.php',
		'class' => 'Bootstrap',
    ),
	/*
    'autoloadernamespaces' => array(
    	'tomato' => 'Tomato_',
    ),
	*/
	'resources' => array(
		'frontController' => array(
			'controllerDirectory' => CMS_APP_DIR . DS . 'controllers',
			'moduleDirectory' 	  => CMS_APP_DIR . DS . 'modules',
		),
	),
);
$options = $application->mergeOptions($application->getOptions(), $options);
$application->setOptions($options)
			->bootstrap()
			->run();
